package com.example.mobile2021606128wje0417;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTltle;
    private RecyclerView rvMainSchools;
    private String[] schools={"深圳职业技术学院","顺德职业技术学院","广东科学职业技术学院","广东轻工职业技术学院","深圳信息职业技术学院","佛山职业技术学院","广东职业技术学院"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main );
        initView();
        //设置列表布局方式为线性布局
        rvMainSchools.setLayoutManager( new LinearLayoutManager( this ) );
        //创建适配器对象
        SchoolAdapter adapter =new SchoolAdapter( schools );
        //将适配器对象设置给RecycleView
        rvMainSchools.setAdapter( adapter );
    }

    private void initView() {
        tvMainTltle = (TextView) findViewById( R.id.tv_main_tltle );
        rvMainSchools = (RecyclerView) findViewById( R.id.rv_main_schools );
    }
}